<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

defined('_JEXEC') or die();

jimport('joomla.application.component.modellist');

class CprojectModelSection extends JModelList {

    protected $_items = null;

    function populateState() {
        $app = JFactory::getApplication();
        $params = $app->getParams();

        // Load the object state.
        $id = JRequest::getInt('id');
        $this->setState('section.id', $id);
        //parent::populateState();
    }

    public function getTable($name = 'Cproject', $prefix = 'Table', $options = array()) {
        return parent::getTable($name, $prefix, $options);
    }

    function getListQuery() {

        if ($this->_items == null) {

            if (empty($id)) {
                $id = $this->getState('section.id');
            }
            $where = array(
                'a.published = 1',
                'a.section_id =' . $id
            );

            return  CprojectDBHelper::getCprojects($sql = true, $where);
        }
    }
}

?>
